package py.fpuna.aiwa.compraventa.droid.activities;

import py.fpuna.aiwa.compraventa.R;
import roboguice.inject.InjectView;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.github.rtyley.android.sherlock.roboguice.activity.RoboSherlockActivity;

public class MainActivity extends RoboSherlockActivity {

	
	@InjectView(R.id.button_geolocalizar_cliente)
	Button geolocalizarClienteButton;
	
	@InjectView(R.id.button_ver_ubicacion_cliente)
	Button verUbicacionClienteButton;
	
	@InjectView(R.id.button_fotografiar_cliente)
	Button fotografiarClienteButton;
	
	@InjectView(R.id.button_ver_fotografia_cliente)
	Button verFotografiaClienteButton;
	
	@InjectView(R.id.button_nueva_venta)
	Button cargarVentaButton;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		
		geolocalizarClienteButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				startActivity(new Intent(MainActivity.this, GeolocalizarClienteActivity.class));
			}
		});
		
		verUbicacionClienteButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				startActivity(new Intent(MainActivity.this, VerUbicacionClienteActivity.class));
			}
		});
		
		fotografiarClienteButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				startActivity(new Intent(MainActivity.this, FotografiarClienteActivity.class));
			}
		});
		
		verFotografiaClienteButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				startActivity(new Intent(MainActivity.this, VerFotografiaClienteActivity.class));
			}
		});
		
		cargarVentaButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				startActivity(new Intent(MainActivity.this, CargarVentaActivity.class));
			}
		});
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getSupportMenuInflater();
		inflater.inflate(R.menu.activity_main, menu);
		return true;
	}

	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.sincronizar:
			return true;
		case R.id.salir:
			this.finish();
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}
}
